The 'oxidation' of Linux

"I was expecting updates to be faster, but part of the problem is that old-time kernel developers are used to C and don't know Rust. They're not exactly excited about having to learn a new language that is, in some respects, very different. So there's been some pushback on Rust. "
Linus Torvalds


Most Linux kernel bugs are memory-related (buffer overflows, use-after-free, null dereferences) because C is simply not always memory-safe; consequently since the early 2020s there's been a movement to update aspects of the kernel by using the Rust language. Rust is designed with more attention to memory management as well as awareness of multiple processes: Rust was designed with modern, concurrent systems in mind — especially where multiple threads or processes might be running at the same time. This also helps avoid race conditions as well as enhancing memory safety.

Rust's use in the Linux kernel started as an experimental project around 2021. The initial discussions and efforts were made by developers like Miguel Ojeda, who started working on a Rust for Linux project. In 2021, Linus Torvalds, the creator of the Linux kernel, expressed support for exploring the possibility of using Rust in the kernel for new modules. However, the idea of adding Rust into the kernel gained more momentum in August 2022 when the first experimental Rust code was merged into the kernel. It's been used in many drivers and modules, and its use is expanding despite scepticism from some in the more established community of kernel hackers, most of whom are C programmers. Inclusion of Rust has led to controversy and sadly a few people have stepped away from the project as a result.¹

I get the feeling that some Linux kernel maintainers just don't care about future code quality, or about stability or security any more. They just want to keep their C code and wish us Rust folks would go away. And that's really sad... and isn't helping make Linux better."
—Asahi Lina, of Asahi Linux

There's some optimism, and as more parts of the kernel are beginning to be written in Rust, more developers are beginning to se the advantages of Rust, to the point that other projects are surfacing; notably, GNU's coreutils will be available written in Rust, a project called uutils². Ubuntu Linux is likely to be an early adopter. This has to be a Good Sign.

Many other projects are being or have been written in Rust, e.g. the RustPython interpreter.

Over time we're certain to see more and more Rust development; almost every week, it seems, I see a new project announcement. AMong them are rewrites of old favourites in daily use by many, including ripgrep, a blazing-fast and friendlier alternative to grep; fd – A simpler fast, user-friendly alternative to find. then there's bat, an enhanced rewrite of the cat utility, providing added feaures in addition to better speed and security; I've come to rely on this as it largely replaces both cat and less for most of my use cases. Exa is one I'm aware of, a replacement for the ubiquitous ls *Nix filelisting command; although I've not yet used it, I'm aware that many others have found value in it. One utility I have found valuable is zoxide, which is an enhanced replacement for cd in the form of many aliases. AMong other hings it mainains a database of commonly-used directories, enabling me to easily change to those most frequently used, a big time-saver, especially given my propensity for typoing long command line arguments.

Slowly but surely, Rust is proving itself as an invaluable addition to the Linux landscape as more developers take advantage of the opportunity to enhance and modernise the tools used every day. As Rust developers look at he tools we've been using for a long time, they are bringing new feature development based on years of use; the outcome is often not just faster and more secure, but more user-friendly, hence more likely to be used.

Given all his, you might wonder whether there's going to be an entirely Rust-based OS, and you'd not be wrong. Redox is intended as an alternative to Linux and according to their website, is

"a microkernel-based, complete, fully-functioning and general-purpose operating system created in 2015, with a focus on safety, freedom, reliability, correctness, and pragmatism. Wherever possible, the system components are written in Rust and run in user-space."




¹https://arstechnica.com/gadgets/2024/09/rust-in-linux-lead-retires-rather-than-deal-with-more-nontechnical-nonsense/
²Uutils at Github



$ xclip -o | wc -w
749